package com.yanqu.road.entity.activity.foxcard.config;

import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.utils.string.StringUtils;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

@FieldTypeAnnotation(tableName = "t_s_activity_fox_lottery")
public class FoxCardLotteryConfig {
    @FieldTypeAnnotation(select = true, orderASC = true, isIndex = true)
    private int activityId;
    @FieldTypeAnnotation(desc = "id", isIndex = true)
    private int id;
    @FieldTypeAnnotation(desc = "品质")
    private int quality;
    @FieldTypeAnnotation(desc = "最大最小")
    private String pointParam;
    @FieldTypeAnnotation(desc = "解签积分")
    private int score;
    @FieldTypeAnnotation(desc = "权重")
    private int weight;

    private List<Integer> pointParams = new ArrayList<>();

    public FoxCardLotteryConfig(ResultSet rs) throws SQLException {
        this.activityId = rs.getInt("activityId");
        this.id = rs.getInt("id");
        this.quality = rs.getInt("quality");
        this.pointParam = rs.getString("pointParam");
        this.score = rs.getInt("score");
        this.weight = rs.getInt("weight");

        this.pointParams = StringUtils.stringToIntegerList(this.pointParam, "\\|");
    }

    public int getActivityId() {
        return activityId;
    }

    public int getId() {
        return id;
    }

    public int getQuality() {
        return quality;
    }

    public String getPointParam() {
        return pointParam;
    }

    public int getScore() {
        return score;
    }

    public int getWeight() {
        return weight;
    }

    public List<Integer> getPointParams() {
        return pointParams;
    }
}
